import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/core/ext/widget_extension.dart';
import 'package:enterprise_v6_app/app/data/entities/application/apply_bean.dart';
import 'package:enterprise_v6_app/app/modules/application/special_operation/standing_book_page/standing_book_controller.dart';

/// 台账操作列表
class StandingBookPage extends StatelessWidget {
  StandingBookPage({super.key});

  final controller = Get.put(StandingBookController());

  Widget _item(ApplyBean bean) {
    return Container(
      margin: EdgeInsets.only(top: bean.name == '作业台账' ? 12.w : 16.w, left: 14.w, right: 14.w),
      padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 9.w, bottom: 9.w),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(8),
      ),
      child: Row(
        children: [
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                bean.name,
                style: TextStyle(
                  fontSize: 16.sp,
                  color: AppColors.font_color_black,
                  fontWeight: FontWeight.w500,
                ),
              ),
              AppGaps.vGap18,
              SvgPicture.asset(AppImages.icon_next_step),
            ],
          ),
          const Spacer(),
          SvgPicture.asset(bean.iconPath),
        ],
      ),
    ).click(() {
      final int i = controller.standingBookList.indexOf(bean);
      Get.toNamed(bean.routes, arguments: i);
    });
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      color: AppColors.bg_color_grey,
      child: Column(
        children: controller.standingBookList.map(_item).toList(),
      ),
    );
  }
}
